#import "layer_game_menu.h"

#import "mgr_game_mission.h"

#define GAME_MENU_WIN_Y 220
#define GAME_MENU_LOSE_Y 300

#define LAYER_GAME_GET_ITEM_LINE_OFFSET 2.0f
#define LAYER_GAME_GET_ITEM_OPEN_TIME 0.2f
#define LAYER_GAME_GET_ITEM_CLOSE_TIME 0.2f
#define LAYER_GAME_GET_ITEM_FONT @"ArialMT"

#if (HARD_WARE == HARD_WARE_IPHONE)
	#define LAYER_GAME_MENU_ITEM_FONT_SIZE 12
#elif (HARD_WARE == HARD_WARE_IPAD)
	#define LAYER_GAME_MENU_ITEM_FONT_SIZE 24
#endif

#if (HARD_WARE == HARD_WARE_IPHONE)
	#define LAYER_GAME_MENU_TUTORIAL_FONT_SIZE 16
#elif (HARD_WARE == HARD_WARE_IPAD)
	#define LAYER_GAME_MENU_TUTORIAL_FONT_SIZE 32
#endif

/*layer_game_menu
*/
@implementation LayerGameMenu

- (id)initLayerGameMenu:(int)State
{
	NSString *_Path;

	if ((self = [super init]))
	{
		/*load resource
		*/
		reLoadResource(&g_CfgGameMenuResourceTable);

		flagFunctionLock_ = false;

		/*background
		*/
		switch (State)
		{
		case GAME_MENU_STATE_PAUSE: break;
		case GAME_MENU_STATE_WIN:
			backgroundWin_ = uiCreateImageObject(&g_CfgGameMenuBackgroundWin, self);
			backgroundWin_.scale = 2.0f;
			break;
		case GAME_MENU_STATE_LOSE:
		case GAME_MENU_STATE_TIME_UP:
			backgroundLose_ = uiCreateImageObject(&g_CfgGameMenuBackgroundLose, self);
			backgroundLose_.scale = 2.0f;
			break;
		default:;
		}

		/*title
		*/
		switch (State)
		{
		case GAME_MENU_STATE_PAUSE: pause_ = uiCreateImageObject(&g_CfgGameMenuImagePause, self); break;
		case GAME_MENU_STATE_WIN: win_ = [self CreateTitleText:@"Nice Shoot!"]; break;
		case GAME_MENU_STATE_LOSE: lose_ = [self CreateTitleText:@"Love Is Over!"]; break;
		case GAME_MENU_STATE_TIME_UP: timeUp_ = [self CreateTitleText:@"Time Over!"]; break;
		default:;
		}

		/*star and text
		*/
		if (GAME_MENU_STATE_WIN == State)
		{
			/*star 1 effect
			*/
			if (CMgrGameMission::Instance()->mission_recrod.flag_star_1)
			{
				starHeartEffect_ = [CCSprite spriteWithFile:@"star_light_effect.png"];
				[self addChild:starHeartEffect_];
				starHeartEffect_.positionInPixels = g_CfgGameMenuStarHeartPosition;
				[starHeartEffect_ runAction:[CCRepeatForever actionWithAction:[CCRotateBy actionWithDuration:1.0f angle:50.0f]]];
			}
			/*star 2 effect
			*/
			if (CMgrGameMission::Instance()->mission_recrod.flag_star_2)
			{
				starEnemyEffect_ = [CCSprite spriteWithFile:@"star_light_effect.png"];
				[self addChild:starEnemyEffect_];
				starEnemyEffect_.positionInPixels = g_CfgGameMenuStarEnemyPosition;
				[starEnemyEffect_ runAction:[CCRepeatForever actionWithAction:[CCRotateBy actionWithDuration:1.0f angle:50.0f]]];
			}
			/*star 3 effect
			*/
			if (CMgrGameMission::Instance()->mission_recrod.flag_star_3)
			{
				starSpecialEffect_ = [CCSprite spriteWithFile:@"star_light_effect.png"];
				[self addChild:starSpecialEffect_];
				starSpecialEffect_.positionInPixels = g_CfgGameMenuStarSpecialPosition;
				[starSpecialEffect_ runAction:[CCRepeatForever actionWithAction:[CCRotateBy actionWithDuration:1.0f angle:50.0f]]];
			}

			/*star 1
			*/
			if (g_RecordMission[g_ChapterMissionID].flag_star_heart)
			{
				_Path = [NSString stringWithUTF8String:g_CfgGameMenuStarOn];
			}
			else
			{
				_Path = [NSString stringWithUTF8String:g_CfgGameMenuStarOff];
			}
			starHeart_ = [CCSprite spriteWithSpriteFrameName:_Path];
			starHeart_.positionInPixels = g_CfgGameMenuStarHeartPosition;
			[self addChild:starHeart_];
			/*star 2
			*/
			if (g_RecordMission[g_ChapterMissionID].flag_star_enemy)
			{
				_Path = [NSString stringWithUTF8String:g_CfgGameMenuStarOn];
			}
			else
			{
				_Path = [NSString stringWithUTF8String:g_CfgGameMenuStarOff];
			}
			starEnemy_ = [CCSprite spriteWithSpriteFrameName:_Path];
			starEnemy_.positionInPixels = g_CfgGameMenuStarEnemyPosition;
			[self addChild:starEnemy_];
			/*star 3
			*/
			if (g_RecordMission[g_ChapterMissionID].flag_star_special)
			{
				_Path = [NSString stringWithUTF8String:g_CfgGameMenuStarOn];
			}
			else
			{
				_Path = [NSString stringWithUTF8String:g_CfgGameMenuStarOff];
			}
			starSpecial_ = [CCSprite spriteWithSpriteFrameName:_Path];
			starSpecial_.positionInPixels = g_CfgGameMenuStarSpecialPosition;
			[self addChild:starSpecial_];

			/*star text
			*/
			switch (CMgrGameMission::Instance()->mission_type)
			{
			case MISSION_TYPE_NORMAL:
				textHeart_ = [self CreateContextText:@"Bridge Through!"];
				textEnemy_ = [self CreateContextText:@"Stage Clear!!"];
				textSpecial_ = [self CreateContextText:@"Item Found!"];
				break;
			case MISSION_TYPE_BOSS:
				textHeart_ = [self CreateContextText:@"Kill Boss!"];
				textEnemy_ = [self CreateContextText:@"Perfect!!"];
				textSpecial_ = [self CreateContextText:@"Item Found!"];
				break;
			default:;
			}
			textHeart_.positionInPixels = g_CfgGameMenuTextHeartPosition;
			textEnemy_.positionInPixels = g_CfgGameMenuTextEnemyPosition;
			textSpecial_.positionInPixels = g_CfgGameMenuTextSpecialPosition;
		}

		/*lose
		*/
		if ((GAME_MENU_STATE_LOSE == State) || (GAME_MENU_STATE_TIME_UP == State))
		{
			id _Action1;
			id _Action2;
			id _Action3;
			id _Action4;
			CCSequence *_Seq;

			loseHeart_ = [CCSprite spriteWithSpriteFrameName:@"loser.png"];
			[self addChild:loseHeart_];
			loseHeart_.positionInPixels = g_ScrrenCenter;
			loseHeart_.scale = 1.5f;
			_Action1 = [CCScaleTo actionWithDuration:0.3f scale:0.8f];
			_Action2 = [CCScaleTo actionWithDuration:0.2f scale:1.0f];
			_Action3 = [CCScaleTo actionWithDuration:0.2f scale:0.8f];
			_Action4 = [CCScaleTo actionWithDuration:0.2f scale:1.0f];
			_Seq = [CCSequence actions:_Action1, _Action2, _Action3, _Action4, nil];
			[loseHeart_ runAction:_Seq];
		}

		/*menu
		*/
		switch (State)
		{
		case GAME_MENU_STATE_PAUSE:
			itemResume_ = uiCreateMenuItemImageObject(&g_CfgGameMenuItemResume, self, @selector(CallBackMenuItemResume:));
			itemRestart_ = uiCreateMenuItemImageObject(&g_CfgGameMenuItemRestart, self, @selector(CallBackMenuItemRestart:));
			itemQuit_ = uiCreateMenuItemImageObject(&g_CfgGameMenuItemQuit, self, @selector(CallBackMenuItemQuit:));
			menuPause_ = uiNodeAddMenu(self, CGPointZero, itemResume_, itemRestart_, itemQuit_, nil);
			break;
		case GAME_MENU_STATE_WIN:
			itemRetry_ = uiCreateMenuItemImageObject(&g_CfgGameMenuItemRetry, self, @selector(CallBackMenuItemRetry:));
			itemNext_ = uiCreateMenuItemImageObject(&g_CfgGameMenuItemNext, self, @selector(CallBackMenuItemNext:));
			itemBackMenu_ = uiCreateMenuItemImageObject(&g_CfgGameMenuItemBackMenu, self, @selector(CallBackMenuItemBackMenu:));
			menuOver_ = uiNodeAddMenu(self, CGPointZero, itemRetry_, itemNext_, itemBackMenu_, nil);
			break;
		case GAME_MENU_STATE_LOSE:
		case GAME_MENU_STATE_TIME_UP:
			itemRetry_ = uiCreateMenuItemImageObject(&g_CfgGameMenuItemRetry, self, @selector(CallBackMenuItemRetry:));
			itemBackMenu_ = uiCreateMenuItemImageObject(&g_CfgGameMenuItemBackMenu, self, @selector(CallBackMenuItemBackMenu:));
			menuOver_ = uiNodeAddMenu(self, CGPointZero, itemRetry_, itemBackMenu_, nil);
			break;
		default:;
		}
	}
	return self;
}

- (void)dealloc
{
	/*release resource
	*/
	reFreeResource(&g_CfgGameMenuResourceTable);

	[super dealloc];
}

- (void)draw
{
	UICenterRect _Rect;

	_Rect.center = ccp(g_ScrrenSize.width / 2, g_ScrrenSize.height / 2);
	_Rect.size = g_ScrrenSize;
	glColor4f(0.0f, 0.0f, 0.0f, 0.7f);
	uiRenderRect(_Rect);
}

- (CCLabelBMFont *)CreateTitleText:(NSString *)String
{
	CCLabelBMFont *_Text;

	_Text = [CCLabelBMFont labelWithString:String fntFile:@"font_over.fnt"];
	[self addChild:_Text];
	_Text.positionInPixels = g_CfgGameMenuTitlePosition;
	_Text.scale = 2.0f;
	return _Text;
}

- (CCLabelBMFont *)CreateContextText:(NSString *)String
{
	CCLabelBMFont *_Text;

	_Text = [CCLabelBMFont labelWithString:String fntFile:@"font_over.fnt"];
	[self addChild:_Text];
	_Text.anchorPoint = ccp(0.0f, 0.5f);
	return _Text;
}

- (void)CreateMenuGetItem
{
	g_SpriteGameMenuGetItem = [[sprite_game_menu_get_item alloc] initSpriteGameMenuGetItem];
	[self addChild:g_SpriteGameMenuGetItem];
	[g_SpriteGameMenuGetItem release];

	flagFunctionLock_ = true;
}

- (void)DeleteMenuGetItem
{
	[self removeChild:g_SpriteGameMenuGetItem cleanup:TRUE];
	g_SpriteGameMenuGetItem = nil;

	flagFunctionLock_ = false;
}

- (void)MissionStart
{
	[g_SceneGame removeChild:g_LayerGameMenu cleanup:TRUE];
	g_LayerGameMenu = nil;
}

- (void)CallBackMenuItemResume:(id)Sender
{
	if (flagFunctionLock_)
	{
		return;
	}

	/*effect
	*/
	EffectButton();

	[g_SceneGame Resume];
	[g_SceneGame removeChild:g_LayerGameMenu cleanup:TRUE];
	g_LayerGameMenu = nil;
}

- (void)CallBackMenuItemRestart:(id)Sender
{
	if (flagFunctionLock_)
	{
		return;
	}

	/*effect
	*/
	EffectButton();

	[g_SceneGame Resume];
	CMgrGameMission::Instance()->MissionOver();
	CMgrGameMission::Instance()->MissionRestart();
}

- (void)CallBackMenuItemQuit:(id)Sender
{
	if (flagFunctionLock_)
	{
		return;
	}

	/*effect
	*/
	EffectButton();
	MusicStop();

	CMgrGameMission::Instance()->MissionOver();

	[g_SceneGame Resume];
	[g_SceneGame SceneChangeToMenu];
}

- (void)CallBackMenuItemRetry:(id)Sender
{
	if (flagFunctionLock_)
	{
		return;
	}

	/*effect
	*/
	EffectButton();

	[g_SceneGame Resume];
	CMgrGameMission::Instance()->MissionRestart();
}

- (void)CallBackMenuItemNext:(id)Sender
{
	if (flagFunctionLock_)
	{
		return;
	}

	/*effect
	*/
	EffectButton();

	CMgrGameMission::Instance()->MissionNext();
}

- (void)CallBackMenuItemBackMenu:(id)Sender
{
	if (flagFunctionLock_)
	{
		return;
	}

	/*effect
	*/
	EffectButton();
	MusicStop();

	[g_SceneGame Resume];
	[g_SceneGame SceneChangeToChapter:CMgrGameMission::Instance()->mission_id];
}

@end

/*sprite_game_menu_get_item
*/
@implementation sprite_game_menu_get_item

- (id)initSpriteGameMenuGetItem
{
	int i, j;
	int _MissionStarCount;
	int _RangePoint;
	int _Random;
	int _Count;
	int _PieceCountTable[ITEM_TYPE_COUNT];
	CCLabelTTF *_Name;
	CCSprite *_Image;
	CCLabelTTF *_Text;
	float _TotalY, _Y;

	if ((self = [super init]))
	{
		dummy_ = [[CCSprite alloc] init];
		[self addChild:dummy_];
		[dummy_ release];
		dummy_.positionInPixels = g_ScrrenCenter;

		/*create range
		*/
		memset(&range_, 0, sizeof range_);
		_RangePoint = 0;
		for (i = 0; i < ITEM_TYPE_COUNT; i++)
		{
			if (0 != CMgrGameMission::Instance()->mission_piece_drop_probability[i])
			{
				range_[i].min = _RangePoint + 1;
				_RangePoint += CMgrGameMission::Instance()->mission_piece_drop_probability[i];
				range_[i].max = _RangePoint;
			}
		}

		/*random count
		*/
		_MissionStarCount = 0;
		if (g_RecordMission[g_ChapterMissionID].flag_star_heart)
		{
			_MissionStarCount++;
		}
		if (g_RecordMission[g_ChapterMissionID].flag_star_enemy)
		{
			_MissionStarCount++;
		}
		if (g_RecordMission[g_ChapterMissionID].flag_star_special)
		{
			_MissionStarCount++;
		}
		_Count = 0;
		_Count = rand() % (CMgrGameMission::Instance()->mission_piece_drop_max_count + 1 + _MissionStarCount);
		if (_Count == 0)
		{
			_Count = 1;
		}

		/*random item
		*/
		memset(&_PieceCountTable, 0, sizeof _PieceCountTable);
		for (i = 0; i < _Count; i++)
		{
			_Random = 1 + rand() % _RangePoint;
			for (j = 0; j < ITEM_TYPE_COUNT; j++)
			{
				if ((range_[j].min <= _Random) && (_Random <= range_[j].max))
				{
					_PieceCountTable[j]++;
				}
			}
		}

		/*create image and text
		*/
		for (i = 0; i < ITEM_TYPE_COUNT; i++)
		{
			if (_PieceCountTable[i] > 0)
			{
				if (g_FlagChinese)
				{
					switch (i)
					{
					case 0: _Name = [CCLabelTTF labelWithString:@"幸福的碎片" fontName:LAYER_GAME_GET_ITEM_FONT fontSize:LAYER_GAME_MENU_ITEM_FONT_SIZE]; break;
					case 1: _Name = [CCLabelTTF labelWithString:@"欲望的碎片" fontName:LAYER_GAME_GET_ITEM_FONT fontSize:LAYER_GAME_MENU_ITEM_FONT_SIZE]; break;
					case 2: _Name = [CCLabelTTF labelWithString:@"美丽的碎片" fontName:LAYER_GAME_GET_ITEM_FONT fontSize:LAYER_GAME_MENU_ITEM_FONT_SIZE]; break;
					case 3: _Name = [CCLabelTTF labelWithString:@"诺言的碎片" fontName:LAYER_GAME_GET_ITEM_FONT fontSize:LAYER_GAME_MENU_ITEM_FONT_SIZE]; break;
					case 4: _Name = [CCLabelTTF labelWithString:@"背叛的碎片" fontName:LAYER_GAME_GET_ITEM_FONT fontSize:LAYER_GAME_MENU_ITEM_FONT_SIZE]; break;
					case 5: _Name = [CCLabelTTF labelWithString:@"痛苦的碎片" fontName:LAYER_GAME_GET_ITEM_FONT fontSize:LAYER_GAME_MENU_ITEM_FONT_SIZE]; break;
					case 6: _Name = [CCLabelTTF labelWithString:@"神秘的碎片" fontName:LAYER_GAME_GET_ITEM_FONT fontSize:LAYER_GAME_MENU_ITEM_FONT_SIZE]; break;
					default:;
					}
				}
				else
				{
					switch (i)
					{
					case 0: _Name = [CCLabelTTF labelWithString:@"Hapiness" fontName:LAYER_GAME_GET_ITEM_FONT fontSize:LAYER_GAME_MENU_ITEM_FONT_SIZE]; break;
					case 1: _Name = [CCLabelTTF labelWithString:@"Desire" fontName:LAYER_GAME_GET_ITEM_FONT fontSize:LAYER_GAME_MENU_ITEM_FONT_SIZE]; break;
					case 2: _Name = [CCLabelTTF labelWithString:@"Beauty" fontName:LAYER_GAME_GET_ITEM_FONT fontSize:LAYER_GAME_MENU_ITEM_FONT_SIZE]; break;
					case 3: _Name = [CCLabelTTF labelWithString:@"Promise" fontName:LAYER_GAME_GET_ITEM_FONT fontSize:LAYER_GAME_MENU_ITEM_FONT_SIZE]; break;
					case 4: _Name = [CCLabelTTF labelWithString:@"Betray" fontName:LAYER_GAME_GET_ITEM_FONT fontSize:LAYER_GAME_MENU_ITEM_FONT_SIZE]; break;
					case 5: _Name = [CCLabelTTF labelWithString:@"pain" fontName:LAYER_GAME_GET_ITEM_FONT fontSize:LAYER_GAME_MENU_ITEM_FONT_SIZE]; break;
					case 6: _Name = [CCLabelTTF labelWithString:@"Mysterious" fontName:LAYER_GAME_GET_ITEM_FONT fontSize:LAYER_GAME_MENU_ITEM_FONT_SIZE]; break;
					default:;
					}
				}

				_Image = [CCSprite spriteWithSpriteFrameName:[NSString stringWithUTF8String:g_CfgPieceTable[i].path]];
				_Text = [CCLabelTTF labelWithString:[NSString stringWithFormat:@"x%d", _PieceCountTable[i]] fontName:LAYER_GAME_GET_ITEM_FONT fontSize:12];
				_Name.anchorPoint = ccp(1.0f, 0.5f);
				_Image.anchorPoint = ccp(0.5f, 1.0f);
				_Text.anchorPoint = ccp(0.0f, 0.5f);
				[dummy_ addChild:_Name];
				[dummy_ addChild:_Image];
				[dummy_ addChild:_Text];
				nameTable_.push_back(_Name);
				imageTable_.push_back(_Image);
				textTable_.push_back(_Text);
			}
		}

		/*image and text position;
		*/
		_TotalY = imageTable_[0].contentSizeInPixels.width * imageTable_.size() + LAYER_GAME_GET_ITEM_LINE_OFFSET * (imageTable_.size() - 1);
		_Y = _TotalY / 2.0f;
		for (i = 0; i < imageTable_.size(); i++)
		{
			nameTable_[i].positionInPixels = ccp(-100.0f, _Y - imageTable_[0].contentSizeInPixels.height / 2.0f);
			imageTable_[i].positionInPixels = ccp(0.0f, _Y);
			textTable_[i].positionInPixels = ccp(100.0f, _Y - imageTable_[0].contentSizeInPixels.height / 2.0f);
			_Y -= imageTable_[i].contentSizeInPixels.height + LAYER_GAME_GET_ITEM_LINE_OFFSET;
		}

		/*cover rect
		*/
		coverRect_.center = CGPointZero;
		coverRect_.size = CGSizeMake(g_ScrrenSize.width, _TotalY + 100.0f);

		[self ActionOpen];

		/*sync item count
		*/
		for (i = 0; i < ITEM_TYPE_COUNT; i++)
		{
			g_RecordPieceCount[i] += _PieceCountTable[i];
		}
		RecordSave();
	}
	return self;
}

- (void)draw
{
	glColor4f(0.0f, 0.0f, 0.0f, 0.8f);
	glPushMatrix();
	glLoadIdentity();
	glTranslatef(g_ScrrenCenter.x, g_ScrrenCenter.y, 0.0f);
	glScalef(1.0f, dummy_.scaleY, 0.0f);
	uiRenderRect(coverRect_);
	glPopMatrix();
}

- (void)TouchEnded:(CGPoint)Point
{
	if (flagTouchLock_)
	{
		return;
	}

	[self ActionClose];
}

- (void)ActionOpen
{
	CCSequence *_Seq;
	id _ActionOpen;
	CCCallFuncN *_CallBackOpenOver;

	dummy_.scaleX = 1.0f;
	dummy_.scaleY = 0.0f;
	_ActionOpen = [CCScaleTo actionWithDuration:LAYER_GAME_GET_ITEM_OPEN_TIME scaleX:1.0f scaleY:1.0f];
	_CallBackOpenOver = [CCCallFuncN actionWithTarget:self selector:@selector(CallBackActionOpenOver:)];
	_Seq = [CCSequence actions:_ActionOpen, _CallBackOpenOver, nil];
	[dummy_ runAction:_Seq];

	flagTouchLock_ = true;
}

- (void)ActionClose
{
	CCSequence *_Seq;
	id _ActionClose;
	CCCallFuncN *_CallBackCloseOver;

	/*effect
	*/
	EffectButton();

	dummy_.scaleX = 1.0f;
	dummy_.scaleY = 1.0f;
	_ActionClose = [CCScaleTo actionWithDuration:LAYER_GAME_GET_ITEM_CLOSE_TIME scaleX:1.0f scaleY:0.0f];
	_CallBackCloseOver = [CCCallFuncN actionWithTarget:self selector:@selector(CallBackActionCloseOver:)];
	_Seq = [CCSequence actions:_ActionClose, _CallBackCloseOver, nil];
	[dummy_ runAction:_Seq];

	flagTouchLock_ = true;
}

- (void)CallBackActionOpenOver:(id)Sender
{
	flagTouchLock_ = false;
}

- (void)CallBackActionCloseOver:(id)Sender
{
	int i;
	CCLabelTTF *_Label;
	std::vector<CCLabelTTF *> _Table;
	float _TotalY;
	float _StartY;

	if ((1 == g_ChapterMissionID) && g_RecordLibraryTutorial)
	{
		g_RecordLibraryTutorial = false;

		/*clear child
		*/
		[dummy_ removeAllChildrenWithCleanup:TRUE];

		/*create text
		*/
		if (g_FlagChinese)
		{
			_Label = [CCLabelTTF labelWithString:@"得到了爱的碎片!" fontName:LAYER_GAME_GET_ITEM_FONT fontSize:LAYER_GAME_MENU_TUTORIAL_FONT_SIZE];
			[dummy_ addChild:_Label];
			_Label.anchorPoint = ccp(0.5f, 1.0f);
			_Table.push_back(_Label);
			_Label = [CCLabelTTF labelWithString:@"你现在可以去爱的实验室" fontName:LAYER_GAME_GET_ITEM_FONT fontSize:LAYER_GAME_MENU_TUTORIAL_FONT_SIZE];
			[dummy_ addChild:_Label];
			_Label.anchorPoint = ccp(0.5f, 1.0f);
			_Table.push_back(_Label);
			_Label = [CCLabelTTF labelWithString:@"体验神奇道具的合成和" fontName:LAYER_GAME_GET_ITEM_FONT fontSize:LAYER_GAME_MENU_TUTORIAL_FONT_SIZE];
			[dummy_ addChild:_Label];
			_Label.anchorPoint = ccp(0.5f, 1.0f);
			_Table.push_back(_Label);
			_Label = [CCLabelTTF labelWithString:@"各种奇妙财富的发现." fontName:LAYER_GAME_GET_ITEM_FONT fontSize:LAYER_GAME_MENU_TUTORIAL_FONT_SIZE];
			[dummy_ addChild:_Label];
			_Label.anchorPoint = ccp(0.5f, 1.0f);
			_Table.push_back(_Label);
		}
		else
		{
			_Label = [CCLabelTTF labelWithString:@"Fragments of love got!" fontName:LAYER_GAME_GET_ITEM_FONT fontSize:LAYER_GAME_MENU_TUTORIAL_FONT_SIZE];
			[dummy_ addChild:_Label];
			_Label.anchorPoint = ccp(0.5f, 1.0f);
			_Table.push_back(_Label);
			_Label = [CCLabelTTF labelWithString:@"Now you can go to Love Library" fontName:LAYER_GAME_GET_ITEM_FONT fontSize:LAYER_GAME_MENU_TUTORIAL_FONT_SIZE];
			[dummy_ addChild:_Label];
			_Label.anchorPoint = ccp(0.5f, 1.0f);
			_Table.push_back(_Label);
			_Label = [CCLabelTTF labelWithString:@"to experiment for magic items" fontName:LAYER_GAME_GET_ITEM_FONT fontSize:LAYER_GAME_MENU_TUTORIAL_FONT_SIZE];
			[dummy_ addChild:_Label];
			_Label.anchorPoint = ccp(0.5f, 1.0f);
			_Table.push_back(_Label);
			_Label = [CCLabelTTF labelWithString:@"and amazing treasures." fontName:LAYER_GAME_GET_ITEM_FONT fontSize:LAYER_GAME_MENU_TUTORIAL_FONT_SIZE];
			[dummy_ addChild:_Label];
			_Label.anchorPoint = ccp(0.5f, 1.0f);
			_Table.push_back(_Label);
		}

		/*position
		*/
		_TotalY = _Table.size() * _Table[0].contentSizeInPixels.height + (_Table.size() - 1) * 2;
		_StartY = _TotalY / 2.0f;
		for (i = 0; i < _Table.size(); i++)
		{
			_Table[i].positionInPixels = ccp(0.0f, _StartY);
			_StartY -= _Table[0].contentSizeInPixels.height + 2;
		}

		coverRect_.size = CGSizeMake(g_ScrrenSize.width, _TotalY + 200);

		[self ActionOpen];
	}
	else
	{
		[g_LayerGameMenu DeleteMenuGetItem];
	}
}

@end